package com.hydl.power.controller;

import com.hydl.power.aop.annotation.LogAnnotation;
import com.hydl.power.pojo.OrderDeliveryMenu;
import com.hydl.power.service.OrderDeliveryService;
import com.hydl.power.service.PowerDataService;
import com.hydl.power.utils.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.LinkedHashSet;
import java.util.List;

/**
 * @author wxb
 * @date 2020/4/16 18:16
 */
@Api(value = "RealTimeController", tags = "实时监测")
@RequestMapping("/realTime")
@RestController
@CrossOrigin
public class RealTimeController {
    @Autowired
    private PowerDataService powerDataService;
    @Autowired
    private OrderDeliveryService orderDeliveryService;


    //@LogAnnotation(module = "实时监测",description = "区域/单位/配电房/设备")
    @GetMapping("/getOrderDeliveryMenu")
    @ApiOperation(value = "区域/单位/配电房/设备", produces = "application/json")
    public Resp<LinkedHashSet<OrderDeliveryMenu>> getAllByPId() {
        List<OrderDeliveryMenu> list = orderDeliveryService.getTree();
        return Resp.success(list);
    }


    //@LogAnnotation(module = "实时监测",description = "获取实时数据")
    @PostMapping("GetPowerData")
    @ApiOperation(value = "获取实时数据", produces = "application/json")

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "navId", value = "设备id",defaultValue = "01986798", dataType = "String"),
    })
    public Resp GetPowerData(String navId) {

        return powerDataService.GetPowerData(navId);
    }
//    @GetMapping("/powerRoomWarn")
//    public Resp Warn()   {
//        return powerDataService.warn();
//    }
}
